import Phaser from 'phaser'
export default class GameOver extends Phaser.Scene {
    constructor() {
        super('GameOver');
    }
    create(data: any) {
        // console.log(data)
        let message = '~~~';
        if ('message' in data) {
            message = data.message;
        }
        let gameWidth = <number>this.sys.game.config.width;
        let gameHeight = <number>this.sys.game.config.height;

        let body: Element = this.add.dom(gameWidth / 2, gameHeight / 2, 'div',
            'background:rgb(129 119 119);  position: relative; width:' + gameWidth + 'px; height:' + gameHeight + 'px;').node;

        

        body.innerHTML = `
        <div id="sceneMask">
            <div id="gameOverBox">
                <h1>游戏结束</h1>
                <p>`+ message + `</p>
                <div class="GameUIButton" id="returnHall" style="background:#426c92;">返回大厅</div>
            </div>
        </div>`;


        body.querySelector('#returnHall')?.addEventListener('click', () => {
            this.scene.start('Hall');
        });

    }
}